﻿using ReflectionStudio.Core.Events;
using System;
using System.Data;
using System.Windows;
using System.Windows.Data;
using System.ComponentModel;
namespace WPFExcelReport
{
    public partial class UIICC_HR : ViewBase
    {
        public VICC_HRSTAMM TMV
        {
            get
            {
                return (VICC_HRSTAMM)MV;
            }
        }
        public UIICC_HR()
        {
            if (DesignerProperties.GetIsInDesignMode(this))
                return;
        }
        public override void vwMaster_CurrentChanged(object sender, EventArgs e)
        {
            base.vwMaster_CurrentChanged(sender, e);

            if (dwMaster == null)
            {
                KEY = "";
            }
            else
            {
                KEY = dwMaster["USERID"].ToString().PadRight(8)
                    + dwMaster["USERID"].ToString().PadRight(40);
            }
        }
        public override void Window_Loaded(object sender, RoutedEventArgs e)
        {
            if (DesignerProperties.GetIsInDesignMode(this))
                return;
            base.Window_Loaded(sender, e);
        }
        public override void LOADBYAUF()
        {
            Locate("USERID", ORDERNUM);
        }
        public void ResetSeq(object sender, RoutedEventArgs e)
        {
            VSDDAT.SD22.RESETSEQ("0022", "  ", "HRSEQ", 1);
            TMV.DeleteICC_HRSTAMM(null, 0);
            foreach (DataRow _dwHR in TBMain.Rows)
            {

                _dwHR["ROWNID"] = VSDDAT.SD22.GETNEXT("0022", "  ", "HRSEQ", 1);
                TMV.InsertICC_HRSTAMM(_dwHR, app.company);
            }
        }
    }
}
